<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Addmmin extends CI_Controller {
	function __construct() {
		parent::__construct();
		$this->load->helper(array('form', 'url'));

	}
	public function server_manager () {
		if (isset($_REQUEST['submit'])) {
			$server_name = $this->input->post('server_name', true);
			$status = $this->input->post('status',true);
			$this->load->model('Server_model');
			$this->Server_model->add_new_server($server_name, $status);
			redirect('addmmin/server_list');
		}
		else {
			$this->load->view('index');
		}
	}
	public function server_list() {
		echo '123';
	}
	public function login() {
		if (isset($_REQUEST['submit'])) {
			$user_name = $this->input->post('user_name', true);
			$password = $this->input->post('password',true);
			$password = md5($password);
			$this->load->model('User_model');
			$this->User_model->check_login($user_name, $password);
			redirect('addmmin/server_manager');
		}
		else {
			$this->load->view('index');
		}
	}
	public function dangky() {
		if (isset($_REQUEST['submit'])) {
			$user_name = $this->input->post('user_name', true);
			$password = $this->input->post('password',true);
			$status = $this->input->post('status',true);
				
			$password = md5($password);
			$this->load->model('User_model');
			$this->User_model->add_admin($user_name, $password, $status);
			redirect('addmmin/login');
		}
		else {
			$this->load->view('index');
		}
	}
}
